<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>茶商城</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->	<link href="<%=request.getContextPath() %>/resources/img/tea.png" rel="icon">
	
		<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/findfriend.css">
	    <link rel="stylesheet" href="<%=request.getContextPath() %>/resources/bootstrap/css/bootstrap.min.css">
	    <script src="<%=request.getContextPath() %>/resources/jquery/jquery-1.11.3.min.js"></script>
		<script src="<%=request.getContextPath() %>/resources/bootstrap/js/bootstrap.min.js"></script>
	 	<script type="text/javascript" src="https://unpkg.com/wangeditor/release/wangEditor.min.js"></script>
		<script src="<%=request.getContextPath() %>/resources/js/findfriend.js"></script>		
		    <script src="<%=request.getContextPath() %>/resources/layer/layer.js"></script>	
			
  </head>
 <body style="background-image: linear-gradient(to top, #fff,#30A12B); height: 965px;">
 <div class="container-fluid">
<input id="usersequence" type="text" value='<%=session.getAttribute("usersequence") %>' hidden>
<input id="nickname" type="text" value='<%=session.getAttribute("nickname") %>' hidden>

	<jsp:include page="/WEB-INF/jsp/menu.jsp" />
	<div class="container col-sm-12">
	
	<div class="form row">
				<form class="form-horizontal" role="form">
				<div class="form-group col-sm-12">
				<label class=" col-sm-4 control-label">用户名</label>
				<div class="col-sm-4">
				<input type="text"  class="form-control" placeholder="USERNAME" name="username" id="username" style="width:300px">
				</div>

				<div class="col-sm-4">
				<input type="button" value="查询" id="queryBtn" class="btn btn-default" style="width:100px">
				</div>
				</div>
				</form>
				<c:choose>
					<c:when test="${not empty user }">
						<div class="form-group col-sm-12" id="querySelfDiv" >
							<table class="table table-bordered table-condensed" id="showTable">
								<tbody>
								<tr>
									<td rowspan="3">
									<div>
									<img src="${user.img }" style="width: 500px;height: 500px;left:0;top: 0;border-radius: 50%;" onclick="add(${user.sequence})"/>
									</div>
										
									</td>
									<td>昵称</td>
								<td>${user.nickname }</td>
							</tr>
							<tr><td>用户性别</td><td>${user.sex }</td></tr>
							<tr><td>用户号码</td><td>${user.phonenumber }</td></tr>
						</tbody>
					</table>
				</div>
			</c:when>
		</c:choose>
		
			
        	<c:choose>
			<c:when test="${not empty list }">
				<div class="form-group col-sm-12" id="queryallDiv">
					<div class="col-sm-12" align="center">
						<table class="table" style="width:900px">
							<thead>
								<tr>
									<th>用户</th>
									<th>用户名</th>
									<th>昵称</th>
									<th>性别</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${list }" var="lis" varStatus="vs">
									<tr>
										<td><img src="${lis.img }" style="width: 50px;height: 50px;left:0;top: 0;border-radius: 50%;"  onclick="find(${lis.sequence})"/></td>
										<td>${lis.username }</td>
										<td>${lis.nickname }</td>
										<td>${lis.sex }</td>
										<td>        		
											<input type="button" value="添加"  class="btn btn-primary" style="width:100px" onclick="add(${lis.sequence})">
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				
				    <div align="center" id="pageDiv">
						<font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
							${page.pageNow} 页</font> <a href="<%=request.getContextPath() %>/findfriend?pageNow=1">首页</a>
						<c:choose>
							<c:when test="${page.pageNow - 1 > 0}">
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=${page.pageNow - 1}">上一页</a>
							</c:when>
							<c:when test="${page.pageNow - 1 <= 0}">
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=1">上一页</a>
							</c:when>
						</c:choose>
						<c:choose>
							<c:when test="${page.totalPageCount==0}">
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=${page.pageNow}">下一页</a>
							</c:when>
							<c:when test="${page.pageNow + 1 < page.totalPageCount}">
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=${page.pageNow + 1}">下一页</a>
							</c:when>
							<c:when test="${page.pageNow + 1 >= page.totalPageCount}">
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=${page.totalPageCount}">下一页</a>
							</c:when>
						</c:choose>
						<c:choose>
							<c:when test="${page.totalPageCount==0}">
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=${page.pageNow}">尾页</a>
							</c:when>
							<c:otherwise>
								<a href="<%=request.getContextPath() %>/findfriend?pageNow=${page.totalPageCount}">尾页</a>
							</c:otherwise>
						</c:choose>
					</div>
				</div>
			</c:when>
			</c:choose>
		</div>
	</div>
	</div>
 </body>
  
</html>
